package info.emm.weiyipro.demo.sdk;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

class SingleExecutorCenter {

   private static ExecutorService executor;
   private static SingleExecutorCenter instance;

   public synchronized static SingleExecutorCenter instance() {
       if (instance == null) {
           executor = Executors.newSingleThreadExecutor();
           instance = new SingleExecutorCenter();
       }
       return instance;
   }
    void clear() {
       instance=null;
       executor=null;
   }
    void run(Runnable runnable) {
       instance().executor.execute(runnable);
   }
}
